<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2021/11/22
 * Time: 11:18
 */
namespace app\index\controller;
use app\index\model\Brand;
use app\index\model\Category;
use app\index\model\Goods;
use think\facade\Request;
use think\facade\View;

class Good{
    public function goodList()
    {
        $where=[];
        $param=Request::param();
        if(isset($param['keywords'])&&$param['keywords']<>'')$where['keywords']=$param['keywords'];
        if(isset($param['is_show'])&&$param['is_show']<>'')$where['is_show']=$param['is_show'];
        if(isset($param['is_hot'])&&$param['is_hot']<>'')$where['is_hot']=$param['is_hot'];
        if(isset($param['is_down'])&&$param['is_down']<>'')$where['is_down']=$param['is_down'];
        if(isset($param['cid'])&&$param['cid']<>'')$where['cid']=$param['cid'];


        $list=Goods::all($where);
        View::assign('list',$list);

        $yi=Category::yi();
        $er=Category::er();
        View::assign('yi',$yi);
        View::assign('er',$er);

        return view('',$where);
    }

    public function goodAdd()
    {
        return view();
    }

    public function goodEdit()
    {
        return view();
    }

    public function cate()
    {
        return view();
    }

    public function cateedit()
    {
        return view();
    }

    public function brandList()
    {
        $where=[];
        $name=input('keywords');
        $input=input();
        if(isset($name) && $name<>'')$where['keywords']=$name;
        if(isset($input['is_hot']) && $input['is_hot']<>'')$where['is_hot']=$input['is_hot'];
        if(isset($input['if_show']) && $input['if_show']<>'')$where['if_show']=$input['if_show'];
//        if(isset($input['logo']) && count($input['logo'])==1)$where['logo']=$input['logo'][0];
        $list=Brand::pp($where);
        View::assign('list',$list);
        View::assign($input);
        View::assign('name',$name);
        return view();
    }

    public function brandAdd()
    {
        return \view();
    }

    public function brandEdit()
    {
        return \view();
    }
}